using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace sharpTV.Entities
{
	#region Tables Struct
	public partial struct Tables
	{
		
		public static string Application = @"sharpTV_Applications";
        
		public static string Channel = @"sharpTV_Channels";
        
		public static string Contact = @"sharpTV_Contacts";
        
		public static string ContactType = @"sharpTV_ContactTypes";
        
		public static string Culture = @"sharpTV_Cultures";
        
		public static string EventX = @"sharpTV_Events";
        
		public static string LogoPosition = @"sharpTV_LogoPositions";
        
		public static string MediaSource = @"sharpTV_MediaSources";
        
		public static string MediaType = @"sharpTV_MediaTypes";
        
		public static string Role = @"sharpTV_Roles";
        
		public static string Spot = @"sharpTV_Spots";
        
		public static string Timeline = @"sharpTV_Timelines";
        
		public static string User = @"sharpTV_Users";
        
		public static string UsersInRole = @"sharpTV_UsersInRoles";
        
	}
	#endregion
    #region Schemas
    public partial class Schemas {
		
		public static TableSchema.Table Application{
            get { return DataService.GetSchema("sharpTV_Applications","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table Channel{
            get { return DataService.GetSchema("sharpTV_Channels","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table Contact{
            get { return DataService.GetSchema("sharpTV_Contacts","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table ContactType{
            get { return DataService.GetSchema("sharpTV_ContactTypes","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table Culture{
            get { return DataService.GetSchema("sharpTV_Cultures","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table EventX{
            get { return DataService.GetSchema("sharpTV_Events","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table LogoPosition{
            get { return DataService.GetSchema("sharpTV_LogoPositions","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table MediaSource{
            get { return DataService.GetSchema("sharpTV_MediaSources","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table MediaType{
            get { return DataService.GetSchema("sharpTV_MediaTypes","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table Role{
            get { return DataService.GetSchema("sharpTV_Roles","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table Spot{
            get { return DataService.GetSchema("sharpTV_Spots","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table Timeline{
            get { return DataService.GetSchema("sharpTV_Timelines","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table User{
            get { return DataService.GetSchema("sharpTV_Users","sharpTVSubSonicProvider"); }
		}
        
		public static TableSchema.Table UsersInRole{
            get { return DataService.GetSchema("sharpTV_UsersInRoles","sharpTVSubSonicProvider"); }
		}
        
	
    }
    #endregion
    #region View Struct
    public partial struct Views 
    {
		
    }
    #endregion
    
    #region Query Factories
	public static partial class DB
	{
        public static DataProvider _provider = DataService.Providers["sharpTVSubSonicProvider"];
        static ISubSonicRepository _repository;
        public static ISubSonicRepository Repository {
            get {
                if (_repository == null)
                    return new SubSonicRepository(_provider);
                return _repository; 
            }
            set { _repository = value; }
        }
	
        public static Select SelectAllColumnsFrom<T>() where T : RecordBase<T>, new()
	    {
            return Repository.SelectAllColumnsFrom<T>();
            
	    }
	    public static Select Select()
	    {
            return Repository.Select();
	    }
	    
		public static Select Select(params string[] columns)
		{
            return Repository.Select(columns);
        }
	    
		public static Select Select(params Aggregate[] aggregates)
		{
            return Repository.Select(aggregates);
        }
   
	    public static Update Update<T>() where T : RecordBase<T>, new()
	    {
            return Repository.Update<T>();
	    }
     
	    
	    public static Insert Insert()
	    {
            return Repository.Insert();
	    }
	    
	    public static Delete Delete()
	    {
            
            return Repository.Delete();
	    }
	    
	    public static InlineQuery Query()
	    {
            
            return Repository.Query();
	    }
	    	    
	    
	}
    #endregion
    
}
#region Databases
public partial struct Databases 
{
	
	public static string sharpTVSubSonicProvider = @"sharpTVSubSonicProvider";
    
}
#endregion